#pragma once
#include "OutImage.h"
#include "Math3D.h"

namespace MASGK
{

	class CBuffer
	{

		protected:
			int				m_Width;
			int				m_Height;
			int				m_Length;
			uint**			m_ColorBuf;
			float**			m_DepthBuf;

		public:
			int				GetWidth() { return m_Width; }
			void			SetWidth(int _w) { m_Width = _w; }
			int				GetHeight() { return m_Height; }
			void			SetHeight(int _h) { m_Height = _h; }
			int				GetLength() { return m_Width * m_Height; }
			void			ClearColor();
			void			ClearDepth();
			void			SetPixel(int, int, uint);
			uint			To32BitColor(color&);
			float			GetDepth(int _x, int _y) { return m_DepthBuf[_x][_y]; }
			void			SetDepth(int _x, int _y, float _depth) { m_DepthBuf[_x][_y] = _depth; }
			uint**			GetColorBuffer() { return m_ColorBuf; }

			virtual void	Clear(float3) = 0;
			virtual void	Save() = 0;
			virtual void	Save(int, int, COutImage&, const char*) = 0;
			virtual void	Save(int, int, const char*) = 0;

			// Constructors & destructor
			CBuffer(void);
			virtual ~CBuffer(void);
	};

}
